package com.question.java.exception;

import org.apache.commons.lang3.Validate;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description:
 * @Author: Jun Yang
 * @Time: 2018/12/20 下午10:15
 * @Version: 1.0
 */
public class Main {

    public static void main(String[] args) {
        String nullObject = null;
        List<String> list = new ArrayList<>();
        list.add("a");
        list.add("b");
        list.add(nullObject);
        list.add("c");
        list.add("d");

        for (String s : list) {
            if ( s == null) {
                Validate.notNull(s, "是一个空值");
            }
            System.out.println(s);
        }
    }

}
